package Thread;



public class SyncDemo3 {
    public static void main(String[] args) {
        Boo b1=new Boo();
        Boo b2=new Boo();

//        Thread t1;
//        t1.run();
//        Thread t1=run()->{b1.doSome();};
//        Thread t2=run()->{b2.doSome();};
        Thread t1=new Thread(){
            public void run() {
                b1.doSome();
            }
        };
        Thread t2=new Thread(){
            public void run() {
                b2.doSome();
            }
        };
//        t1.run();{
//
//            b1.doSome();
//        }
//
//        t2.run();{
//            b2.doSome();
//        }
        t1.start();
        t2.start();

    }
}

class Boo{
    public static void doSome(){
        synchronized(Boo.class){
            Thread t=Thread.currentThread();
            System.out.println(t+"正在执行doSome方法...");
            try{
                Thread.sleep(5000);
            }catch(InterruptedException e){

            }
            System.out.println(t+"执行doSome方法完毕...");
        }
    }
}